home *** CD-ROM | disk | FTP | other *** search
- # DroidWorks
- # Infrared capability cog
- #
- # Floodlight ability is in inventory bin 11
- # Power is in inventory bin 20
-
- symbols
-
- thing player
- int actorFlags
-
- message activated
- message pulse
-
- sound lightActivate=NRGt8InfraOn.wav local
- sound lightDeactivate=NRGt8InfraOff.wav local
-
- end
-
- # ========================================================================================
-
- code
-
- activated:
- player = GetSourceRef();
- actorFlags = GetActorFlags(player);
-
- if(GetInv(player, 11))
- {
- if(BitTest(actorFlags, 4) == 0)
- {
- if(GetInv(player, 20) > 0)
- {
- # Print("Floodlight activated");
- SetActorFlags(player, 4);
- SetInvActivated(player, 11, 1);
- PlaySoundThing(lightActivate, player, 1.0, -1, -1, 0x80);
- SetPulse(1.5);
- }
- else
- {
- # Print("No power for Floodlight");
- PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
- }
- }
- else
- {
- # Print("Floodlight deactivated");
- ClearActorFlags(player, 4);
- SetInvActivated(player, 11, 0);
- PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
- SetPulse(0);
- }
- }
- return;
-
- # ........................................................................................
-
- pulse:
- ChangeInv(player, 20, -15);
-
- if(GetInv(player, 20) == 0)
- {
- # Print("No power for Floodlight");
- ClearActorFlags(player, 4);
- SetInvActivated(player, 11, 0);
- PlaySoundThing(lightDeactivate, player, 1.0, -1, -1, 0x80);
- SetPulse(0);
- }
- return;
-
- end
-